﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using System.Collections;
namespace TS_XY_Train_Repaire.Locomotive.MainBase
{
    public partial class Locomotive_MainBase_WorkFlow_ManaForm_Train : DevExpress.XtraEditors.XtraForm
    {
        public string _FlowType = "0";
        public Locomotive_MainBase_WorkFlow_ManaForm_Train()
        {
            InitializeComponent();
        }

        private void Locomotive_MainBase_WorkFlow_ManaForm_Train_Load(object sender, EventArgs e)
        {
            _LoadTreeList();
        }

        private void Locomotive_MainBase_WorkFlow_ManaForm_Train_FormClosing(object sender, FormClosingEventArgs e)
        {
            TS_Win_Locomotive_MainForm.htActionItem.Remove(this.Name);
        }
        #region//--作业流程目录事件--//
        private void _LoadTreeList()
        {
            TR_PS_Work_Main_List _tl = new TR_PS_Work_Main_List();
            tl_Main.Nodes.Clear();
            ArrayList pList = new ArrayList();
            _tl = new TR_PS_Work_Main_List();
            _tl.f_id = "W0";
            _tl.f_name = "整车作业流程目录";
            _tl.f_imgindex = 14;
            pList.Add(_tl);
            string strSQL = "select * from TS_TR_PS_Work_Main where f_del=0 and f_type="+_FlowType;
            SqlConnection conn = new SqlConnection(TS_Win_Class.GetSQlConnStr());
            conn.Open();
            SqlCommand cmd = new SqlCommand(strSQL, conn);
            SqlDataReader read = cmd.ExecuteReader();
            while (read.Read())
            {
                _tl = new TR_PS_Work_Main_List();
                _tl.f_id = "M" + read["f_id"].ToString();
                _tl.f_name = read["f_name"].ToString();
                _tl.f_parent = "W"+ read["f_type"].ToString();
                _tl.f_rpid= read["f_rpid"].ToString();
                _tl.f_imgindex = 10;
                pList.Add(_tl);
            }
            read.Close();
            strSQL = "select * from TS_TR_PS_Work_Main_Day where f_mwid in (select f_id from TS_TR_PS_Work_Main where f_del=0 and f_type=" + _FlowType+") and f_del=0 order by f_mwid,f_order asc";
            cmd = new SqlCommand(strSQL, conn);
            read = cmd.ExecuteReader();
            while (read.Read())
            {
                _tl = new TR_PS_Work_Main_List();
                _tl.f_id = "D" + read["f_id"].ToString();
                _tl.f_order = read["f_order"].ToString();
                _tl.f_name = read["f_name"].ToString();
                _tl.f_mwid = read["f_mwid"].ToString();
                _tl.f_mwdid = read["f_id"].ToString();
                _tl.f_length = read["f_length"].ToString()+"天";
                _tl.f_parent = "M" + read["f_mwid"].ToString();
                _tl.f_imgindex = 11;
                pList.Add(_tl);
            }
            read.Close();
            strSQL = "select * from TS_TR_PS_Work_Main_Steps where f_mwdid in (select f_id from TS_TR_PS_Work_Main_Day where f_mwid in (select f_id from TS_TR_PS_Work_Main where f_del=0 and f_type=" + _FlowType + ") and f_del=0) and f_del=0 order by f_mwid,f_mwdid,f_order asc";
            cmd = new SqlCommand(strSQL, conn);
            read = cmd.ExecuteReader();
            while (read.Read())
            {
                _tl = new TR_PS_Work_Main_List();
                _tl.f_id = "S" + read["f_id"].ToString();
                _tl.f_order = read["f_order"].ToString();
                _tl.f_name = read["f_name"].ToString();
                _tl.f_mwid = read["f_mwid"].ToString();
                _tl.f_mwdid = read["f_mwdid"].ToString();
                _tl.f_mwsid = read["f_id"].ToString();
                _tl.f_length = read["f_length"].ToString() + "小时"; ;
                _tl.f_stime = read["f_stime"].ToString();
                _tl.f_etime = read["f_etime"].ToString();
                _tl.f_parent = "D" + read["f_mwdid"].ToString();
                _tl.f_imgindex = 12;
                pList.Add(_tl);
            }
            read.Close();
            strSQL = "select * from TS_TR_PS_Work_Main_Group where f_mwsid in(select f_id from TS_TR_PS_Work_Main_Steps where f_mwdid in (select f_id from TS_TR_PS_Work_Main_Day where f_mwid in (select f_id from TS_TR_PS_Work_Main where f_del=0 and f_type=" + _FlowType + ") and f_del=0) and f_del=0) and f_del=0 order by f_mwid,f_mwdid,f_mwsid,f_order asc";
            cmd = new SqlCommand(strSQL, conn);
            read = cmd.ExecuteReader();
            while (read.Read())
            {
                _tl = new TR_PS_Work_Main_List();
                _tl.f_id = "G" + read["f_id"].ToString();
                _tl.f_order = read["f_order"].ToString();
                _tl.f_name = read["f_name"].ToString();
                _tl.f_mwid = read["f_mwid"].ToString();
                _tl.f_mwdid = read["f_mwdid"].ToString();
                _tl.f_mwsid = read["f_mwsid"].ToString();
                _tl.f_mwgid = read["f_id"].ToString();
                _tl.f_length = read["f_length"].ToString() + "分钟";
                _tl.f_stime = read["f_stime"].ToString();
                _tl.f_etime = read["f_etime"].ToString();
                _tl.f_parent = "S" + read["f_mwsid"].ToString();
                _tl.f_imgindex = 13;
                pList.Add(_tl);
            }
            read.Close();
            conn.Close();
            conn.Dispose();
            tl_Main.DataSource = pList;
        }
        private void tl_Main_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
        {
            bbi_WorkMain_Add.Enabled = false;
            bbi_WorkMain_Del.Enabled = false;
            bbi_WorkDay_Add.Enabled = false;
            bbi_WorkDay_Edit.Enabled = false;
            bbi_WorkDay_Del.Enabled = false;
            bbi_WorkSteps_Add.Enabled = false;
            bbi_WorkSteps_Edit.Enabled = false;
            bbi_WorkSteps_Del.Enabled = false;
            bbi_WorkGroup_Add.Enabled = false;
            bbi_WorkGroup_Edit.Enabled = false;
            bbi_WorkGroup_Del.Enabled = false;
            bbi_WorkPlace_Add.Enabled = false;
            try
            {
                switch (tl_Main.FocusedNode["f_id"].ToString().Substring(0, 1))
                {
                    case "W":
                        bbi_WorkMain_Add.Enabled = true;
                        break;
                    case "M":
                        bbi_WorkMain_Del.Enabled = true;
                        bbi_WorkDay_Add.Enabled = true;
                        break;
                    case "D":
                        bbi_WorkDay_Del.Enabled = true;
                        bbi_WorkDay_Edit.Enabled = true;
                        bbi_WorkSteps_Add.Enabled = true;
                        break;
                    case "S":
                        bbi_WorkSteps_Del.Enabled = true;
                        bbi_WorkSteps_Edit.Enabled = true;
                        bbi_WorkGroup_Add.Enabled = true;
                        break;
                    case "G":
                        bbi_WorkGroup_Del.Enabled = true;
                        bbi_WorkGroup_Edit.Enabled = true;
                        bbi_WorkPlace_Add.Enabled = true;
                        break;
                }
            }
            catch
            {
                bbi_WorkMain_Add.Enabled = false;
                bbi_WorkMain_Del.Enabled = false;
                bbi_WorkDay_Add.Enabled = false;
                bbi_WorkDay_Edit.Enabled = false;
                bbi_WorkDay_Del.Enabled = false;
                bbi_WorkSteps_Add.Enabled = false;
                bbi_WorkSteps_Edit.Enabled = false;
                bbi_WorkSteps_Del.Enabled = false;
                bbi_WorkGroup_Add.Enabled = false;
                bbi_WorkGroup_Edit.Enabled = false;
                bbi_WorkGroup_Del.Enabled = false;
                bbi_WorkPlace_Add.Enabled = false;
            }
        }

        private void tl_Main_DoubleClick(object sender, EventArgs e)
        {
            try
            {
                if (tl_Main.FocusedNode["f_id"].ToString().Substring(0, 1) == "W")
                {
                    gc_Main.DataSource = null;
                    gc_Main.Refresh();
                }
                else
                {
                    switch (tl_Main.FocusedNode["f_id"].ToString().Substring(0, 1))
                    {
                        case "M":
                            _LoadGrid(" and f_mwid="+ tl_Main.FocusedNode["f_id"].ToString().Substring(1));
                            break;
                        case "D":
                            _LoadGrid(" and f_mwdid=" + tl_Main.FocusedNode["f_id"].ToString().Substring(1));
                            break;
                        case "S":
                            _LoadGrid(" and f_mwsid=" + tl_Main.FocusedNode["f_id"].ToString().Substring(1));
                            break;
                        case "G":
                            _LoadGrid(" and f_mwgid=" + tl_Main.FocusedNode["f_id"].ToString().Substring(1));
                            break;
                    }
                }
            }
            catch
            {
                gc_Main.DataSource = null;
                gc_Main.Refresh();
            }
        }

        private void bbi_WorkMain_Add_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            string _NowID = tl_Main.FocusedNode["f_id"].ToString();
            switch (tl_Main.FocusedNode["f_id"].ToString().Substring(1))
            {
                case "0":
                    UserCon.Locomotive.Technology.uc_Locomotive_MainBase_WorkFlow_TrainWorkMain _uc = new UserCon.Locomotive.Technology.uc_Locomotive_MainBase_WorkFlow_TrainWorkMain();
                    _uc._LoadType = "Add";
                    if (_uc.ShowDialog() == DialogResult.OK)
                    {
                        _LoadTreeList();
                        tl_Main.SetFocusedNode(tl_Main.FindNodeByFieldValue("f_id", _NowID));
                    }
                    break;
                case "1":
                    UserCon.Locomotive.Technology.uc_Locomotive_MainBase_WorkFlow_BogieWorkMain _uc1 = new UserCon.Locomotive.Technology.uc_Locomotive_MainBase_WorkFlow_BogieWorkMain();
                    _uc1._LoadType = "Add";
                    if (_uc1.ShowDialog() == DialogResult.OK)
                    {
                        _LoadTreeList();
                        tl_Main.SetFocusedNode(tl_Main.FindNodeByFieldValue("f_id", _NowID));
                    }
                    break;
                case "2":
                    UserCon.Locomotive.Technology.uc_Locomotive_MainBase_WorkFlow_ElectricWorkMain _uc2 = new UserCon.Locomotive.Technology.uc_Locomotive_MainBase_WorkFlow_ElectricWorkMain();
                    _uc2._LoadType = "Add";
                    if (_uc2.ShowDialog() == DialogResult.OK)
                    {
                        _LoadTreeList();
                        tl_Main.SetFocusedNode(tl_Main.FindNodeByFieldValue("f_id", _NowID));
                    }
                    break;
            }
        }

        private void bbi_WorkMain_Del_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            string _NowID = tl_Main.FocusedNode.ParentNode["f_id"].ToString();
            switch (tl_Main.FocusedNode["f_id"].ToString().Substring(1))
            {
                case "0":
                    break;
                case "1":
                    break;
                case "2":
                    break;
            }
            _LoadTreeList();
            tl_Main.SetFocusedNode(tl_Main.FindNodeByFieldValue("f_id", _NowID));
        }
        #endregion
        #region//--作业项点事件--//
        private void _LoadGrid(string _str)
        {
            string strSQL = "select *,(select f_name from TS_S_T_P_TrainClass where f_id=TS_TR_PS_Work_Main_Group_WorkPlace.f_tcid) as f_tcname,(select f_name from TS_S_T_P_TrainPerf where f_id=TS_TR_PS_Work_Main_Group_WorkPlace.f_perfid) as f_perfname,(select f_name from TS_S_T_P_TrainPerf where f_id=TS_TR_PS_Work_Main_Group_WorkPlace.f_perfid) as f_perfname,(select f_name from TS_S_T_B_TrainMust where f_id=TS_TR_PS_Work_Main_Group_WorkPlace.f_must) as f_mustname,(select f_name from TS_S_T_B_TrainRank where f_id=TS_TR_PS_Work_Main_Group_WorkPlace.f_rank) as f_rankname,(select f_name from TS_S_T_B_TrainDataType where f_id=TS_TR_PS_Work_Main_Group_WorkPlace.f_dtid) as f_dtname,(select f_name from TS_S_T_B_TrainRank where f_id=TS_TR_PS_Work_Main_Group_WorkPlace.f_rank) as f_rankname,(select f_name from TS_S_T_P_WorkPlaceType where f_id=TS_TR_PS_Work_Main_Group_WorkPlace.f_typeid) as f_typename from TS_TR_PS_Work_Main_Group_WorkPlace where f_del=0" + _str;
            DataTable dt = new DataTable();
            TS_Win_Class.FilledDataTable(strSQL, dt);
            gc_Main.DataSource = dt;
        }
        private void gc_Main_Click(object sender, EventArgs e)
        {
            if (gv_Main.SelectedRowsCount>0)
            {
                bbi_WorkPlace_Edit.Enabled = true;
                bbi_WorkPlace_Del.Enabled = true;
            }
            else
            {
                bbi_WorkPlace_Edit.Enabled = false;
                bbi_WorkPlace_Del.Enabled = false;
            }
        }

        private void bbi_WorkPlace_Add_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            UserCon.Locomotive.Technology.uc_Locomotive_MainBase_WorkFlow_TrainWorkPlace _uc = new UserCon.Locomotive.Technology.uc_Locomotive_MainBase_WorkFlow_TrainWorkPlace();
            _uc._LoadID = tl_Main.FocusedNode["f_id"].ToString().Substring(1);
            _uc._LoadMWID = tl_Main.FocusedNode["f_mwid"].ToString();
            _uc._LoadMWDID = tl_Main.FocusedNode["f_mwdid"].ToString();
            _uc._LoadMWSID = tl_Main.FocusedNode["f_mwsid"].ToString();
            _uc._LoadName = tl_Main.FocusedNode["f_name"].ToString();
            _uc.ShowDialog();
            try
            {
                if (tl_Main.FocusedNode["f_id"].ToString().Substring(0, 1) == "W")
                {
                    gc_Main.DataSource = null;
                    gc_Main.Refresh();
                }
                else
                {
                    switch (tl_Main.FocusedNode["f_id"].ToString().Substring(0, 1))
                    {
                        case "M":
                            _LoadGrid(" and f_mwid=" + tl_Main.FocusedNode["f_id"].ToString().Substring(1));
                            break;
                        case "D":
                            _LoadGrid(" and f_mwdid=" + tl_Main.FocusedNode["f_id"].ToString().Substring(1));
                            break;
                        case "S":
                            _LoadGrid(" and f_mwsid=" + tl_Main.FocusedNode["f_id"].ToString().Substring(1));
                            break;
                        case "G":
                            _LoadGrid(" and f_mwgid=" + tl_Main.FocusedNode["f_id"].ToString().Substring(1));
                            break;
                    }
                }
            }
            catch
            {
                gc_Main.DataSource = null;
                gc_Main.Refresh();
            }
        }

        private void bbi_WorkPlace_Edit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            UserCon.Locomotive.Technology.uc_Locomotive_MainBase_WorkFlow_TrainWorkPlace_Edit _uc = new UserCon.Locomotive.Technology.uc_Locomotive_MainBase_WorkFlow_TrainWorkPlace_Edit();
            _uc._LoadID = gv_Main.GetRowCellValue(gv_Main.GetSelectedRows()[0], "f_id").ToString();
            _uc._LoadType = "Edit";
            _uc._LoadTCID = gv_Main.GetRowCellValue(gv_Main.GetSelectedRows()[0], "f_tcid").ToString();
            _uc.ShowDialog();
            try
            {
                if (tl_Main.FocusedNode["f_id"].ToString().Substring(0, 1) == "W")
                {
                    gc_Main.DataSource = null;
                    gc_Main.Refresh();
                }
                else
                {
                    switch (tl_Main.FocusedNode["f_id"].ToString().Substring(0, 1))
                    {
                        case "M":
                            _LoadGrid(" and f_mwid=" + tl_Main.FocusedNode["f_id"].ToString().Substring(1));
                            break;
                        case "D":
                            _LoadGrid(" and f_mwdid=" + tl_Main.FocusedNode["f_id"].ToString().Substring(1));
                            break;
                        case "S":
                            _LoadGrid(" and f_mwsid=" + tl_Main.FocusedNode["f_id"].ToString().Substring(1));
                            break;
                        case "G":
                            _LoadGrid(" and f_mwgid=" + tl_Main.FocusedNode["f_id"].ToString().Substring(1));
                            break;
                    }
                }
            }
            catch
            {
                gc_Main.DataSource = null;
                gc_Main.Refresh();
            }
            bbi_WorkPlace_Edit.Enabled = false;
            bbi_WorkPlace_Del.Enabled = false;
        }

        private void bbi_WorkPlace_Del_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            UserCon.Locomotive.Technology.uc_Locomotive_MainBase_WorkFlow_TrainWorkPlace_Edit _uc = new UserCon.Locomotive.Technology.uc_Locomotive_MainBase_WorkFlow_TrainWorkPlace_Edit();
            _uc._LoadID = gv_Main.GetRowCellValue(gv_Main.GetSelectedRows()[0], "f_id").ToString();
            _uc._LoadType = "Del";
            _uc._LoadTCID = gv_Main.GetRowCellValue(gv_Main.GetSelectedRows()[0], "f_tcid").ToString();
            _uc.ShowDialog();
            try
            {
                if (tl_Main.FocusedNode["f_id"].ToString().Substring(0, 1) == "W")
                {
                    gc_Main.DataSource = null;
                    gc_Main.Refresh();
                }
                else
                {
                    switch (tl_Main.FocusedNode["f_id"].ToString().Substring(0, 1))
                    {
                        case "M":
                            _LoadGrid(" and f_mwid=" + tl_Main.FocusedNode["f_id"].ToString().Substring(1));
                            break;
                        case "D":
                            _LoadGrid(" and f_mwdid=" + tl_Main.FocusedNode["f_id"].ToString().Substring(1));
                            break;
                        case "S":
                            _LoadGrid(" and f_mwsid=" + tl_Main.FocusedNode["f_id"].ToString().Substring(1));
                            break;
                        case "G":
                            _LoadGrid(" and f_mwgid=" + tl_Main.FocusedNode["f_id"].ToString().Substring(1));
                            break;
                    }
                }
            }
            catch
            {
                gc_Main.DataSource = null;
                gc_Main.Refresh();
            }
            bbi_WorkPlace_Edit.Enabled = false;
            bbi_WorkPlace_Del.Enabled = false;
        }

        #endregion
        private void bbi_Reload_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                string _NowID = tl_Main.FocusedNode["f_id"].ToString();
                _LoadTreeList();
                tl_Main.SetFocusedNode(tl_Main.FindNodeByFieldValue("f_id", _NowID));
            }
            catch
            {
            }
            try
            {
                if (tl_Main.FocusedNode["f_id"].ToString().Substring(0, 1) == "W")
                {
                    gc_Main.DataSource = null;
                    gc_Main.Refresh();
                }
                else
                {
                    switch (tl_Main.FocusedNode["f_id"].ToString().Substring(0, 1))
                    {
                        case "M":
                            _LoadGrid(" and f_mwid=" + tl_Main.FocusedNode["f_id"].ToString().Substring(1));
                            break;
                        case "D":
                            _LoadGrid(" and f_mwdid=" + tl_Main.FocusedNode["f_id"].ToString().Substring(1));
                            break;
                        case "S":
                            _LoadGrid(" and f_mwsid=" + tl_Main.FocusedNode["f_id"].ToString().Substring(1));
                            break;
                        case "G":
                            _LoadGrid(" and f_mwgid=" + tl_Main.FocusedNode["f_id"].ToString().Substring(1));
                            break;
                    }
                }
            }
            catch
            {
                gc_Main.DataSource = null;
                gc_Main.Refresh();
            }

        }
        #region//--作业流程--//

        private void bbi_WorkDay_Add_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            string _NowID = tl_Main.FocusedNode["f_id"].ToString();
            UserCon.Locomotive.Technology.uc_Locomotive_MainBase_WorkFlow_TrainWorkDay _uc = new UserCon.Locomotive.Technology.uc_Locomotive_MainBase_WorkFlow_TrainWorkDay();
            _uc._LoadType = "Add";
            _uc._LoadMWID = tl_Main.FocusedNode["f_id"].ToString().Substring(1);
            if (_uc.ShowDialog() == DialogResult.OK)
            {
                _LoadTreeList();
                tl_Main.SetFocusedNode(tl_Main.FindNodeByFieldValue("f_id", _NowID));
            }
        }

        private void bbi_WorkDay_Edit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            string _NowID = tl_Main.FocusedNode["f_id"].ToString();
            UserCon.Locomotive.Technology.uc_Locomotive_MainBase_WorkFlow_TrainWorkDay _uc = new UserCon.Locomotive.Technology.uc_Locomotive_MainBase_WorkFlow_TrainWorkDay();
            _uc._LoadType = "Edit";
            _uc._LoadID = tl_Main.FocusedNode["f_id"].ToString().Substring(1);
            _uc._LoadMWID = tl_Main.FocusedNode["f_mwid"].ToString().Substring(1);
            if (_uc.ShowDialog() == DialogResult.OK)
            {
                _LoadTreeList();
                tl_Main.SetFocusedNode(tl_Main.FindNodeByFieldValue("f_id", _NowID));
            }
        }

        private void bbi_WorkDay_Del_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            string _NowID = tl_Main.FocusedNode.ParentNode["f_id"].ToString();
            UserCon.Locomotive.Technology.uc_Locomotive_MainBase_WorkFlow_TrainWorkDay _uc = new UserCon.Locomotive.Technology.uc_Locomotive_MainBase_WorkFlow_TrainWorkDay();
            _uc._LoadType = "Del";
            _uc._LoadID = tl_Main.FocusedNode["f_id"].ToString().Substring(1);
            _uc._LoadMWID = tl_Main.FocusedNode["f_mwid"].ToString().Substring(1);
            if (_uc.ShowDialog() == DialogResult.OK)
            {
                _LoadTreeList();
                tl_Main.SetFocusedNode(tl_Main.FindNodeByFieldValue("f_id", _NowID));
            }
        }
        #endregion
        #region//--作业工步--//

        private void bbi_WorkSteps_Add_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            string _NowID = tl_Main.FocusedNode["f_id"].ToString();
            UserCon.Locomotive.Technology.uc_Locomotive_MainBase_WorkFlow_TrainWorkSteps _uc = new UserCon.Locomotive.Technology.uc_Locomotive_MainBase_WorkFlow_TrainWorkSteps();
            _uc._LoadType = "Add";
            _uc._LoadMWID = tl_Main.FocusedNode["f_mwid"].ToString();
            _uc._LoadMWDID = tl_Main.FocusedNode["f_id"].ToString().Substring(1);
            if (_uc.ShowDialog() == DialogResult.OK)
            {
                _LoadTreeList();
                tl_Main.SetFocusedNode(tl_Main.FindNodeByFieldValue("f_id", _NowID));
            }
        }

        private void bbi_WorkSteps_Edit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            string _NowID = tl_Main.FocusedNode["f_id"].ToString();
            UserCon.Locomotive.Technology.uc_Locomotive_MainBase_WorkFlow_TrainWorkSteps _uc = new UserCon.Locomotive.Technology.uc_Locomotive_MainBase_WorkFlow_TrainWorkSteps();
            _uc._LoadType = "Edit";
            _uc._LoadID = tl_Main.FocusedNode["f_id"].ToString().Substring(1);
            _uc._LoadMWID = tl_Main.FocusedNode["f_mwid"].ToString();
            _uc._LoadMWDID = tl_Main.FocusedNode["f_mwdid"].ToString();
            if (_uc.ShowDialog() == DialogResult.OK)
            {
                _LoadTreeList();
                tl_Main.SetFocusedNode(tl_Main.FindNodeByFieldValue("f_id", _NowID));
            }
        }

        private void bbi_WorkSteps_Del_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            string _NowID = tl_Main.FocusedNode.ParentNode["f_id"].ToString();
            UserCon.Locomotive.Technology.uc_Locomotive_MainBase_WorkFlow_TrainWorkSteps _uc = new UserCon.Locomotive.Technology.uc_Locomotive_MainBase_WorkFlow_TrainWorkSteps();
            _uc._LoadType = "Del";
            _uc._LoadID = tl_Main.FocusedNode["f_id"].ToString().Substring(1);
            _uc._LoadMWID = tl_Main.FocusedNode["f_mwid"].ToString();
            _uc._LoadMWDID = tl_Main.FocusedNode["f_mwdid"].ToString();
            if (_uc.ShowDialog() == DialogResult.OK)
            {
                _LoadTreeList();
                tl_Main.SetFocusedNode(tl_Main.FindNodeByFieldValue("f_id", _NowID));
            }
        }
        #endregion
        #region//--作业组--//

        private void bbi_WorkGroup_Add_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            string _NowID = tl_Main.FocusedNode["f_id"].ToString();
            UserCon.Locomotive.Technology.uc_Locomotive_MainBase_WorkFlow_TrainWorkGroup _uc = new UserCon.Locomotive.Technology.uc_Locomotive_MainBase_WorkFlow_TrainWorkGroup();
            _uc._LoadType = "Add";
            _uc._LoadMWID = tl_Main.FocusedNode["f_mwid"].ToString();
            _uc._LoadMWDID = tl_Main.FocusedNode["f_mwdid"].ToString();
            _uc._LoadMWSID = tl_Main.FocusedNode["f_id"].ToString().Substring(1);
            if (_uc.ShowDialog() == DialogResult.OK)
            {
                _LoadTreeList();
                tl_Main.SetFocusedNode(tl_Main.FindNodeByFieldValue("f_id", _NowID));
            }
        }

        private void bbi_WorkGroup_Edit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            string _NowID = tl_Main.FocusedNode["f_id"].ToString();
            UserCon.Locomotive.Technology.uc_Locomotive_MainBase_WorkFlow_TrainWorkGroup _uc = new UserCon.Locomotive.Technology.uc_Locomotive_MainBase_WorkFlow_TrainWorkGroup();
            _uc._LoadType = "Edit";
            _uc._LoadID = tl_Main.FocusedNode["f_id"].ToString().Substring(1);
            _uc._LoadMWID = tl_Main.FocusedNode["f_mwid"].ToString();
            _uc._LoadMWDID = tl_Main.FocusedNode["f_mwdid"].ToString();
            _uc._LoadMWSID = tl_Main.FocusedNode["f_mwsid"].ToString();
            if (_uc.ShowDialog() == DialogResult.OK)
            {
                _LoadTreeList();
                tl_Main.SetFocusedNode(tl_Main.FindNodeByFieldValue("f_id", _NowID));
            }
        }

        private void bbi_WorkGroup_Del_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            string _NowID = tl_Main.FocusedNode.ParentNode["f_id"].ToString();
            UserCon.Locomotive.Technology.uc_Locomotive_MainBase_WorkFlow_TrainWorkGroup _uc = new UserCon.Locomotive.Technology.uc_Locomotive_MainBase_WorkFlow_TrainWorkGroup();
            _uc._LoadType = "Del";
            _uc._LoadID = tl_Main.FocusedNode["f_id"].ToString().Substring(1);
            _uc._LoadMWID = tl_Main.FocusedNode["f_mwid"].ToString();
            _uc._LoadMWDID = tl_Main.FocusedNode["f_mwdid"].ToString();
            _uc._LoadMWSID = tl_Main.FocusedNode["f_mwsid"].ToString();
            if (_uc.ShowDialog() == DialogResult.OK)
            {
                _LoadTreeList();
                tl_Main.SetFocusedNode(tl_Main.FindNodeByFieldValue("f_id", _NowID));
            }
        }
        #endregion

        private void bbi_Dep_WorkFlow_Relation_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            UserCon.Locomotive.Technology.uc_Locomotive_MainBase_WorkFlow_WorkingDepRelation _uc = new UserCon.Locomotive.Technology.uc_Locomotive_MainBase_WorkFlow_WorkingDepRelation();
            _uc._LoadID = tl_Main.FocusedNode["f_id"].ToString();
            _uc._LoadName = tl_Main.FocusedNode["f_name"].ToString();
            _uc.ShowDialog();
        }
    }
}